<html>
	<head>
		<title>桥接模式</title>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
		<script>
			var Calculator = {
				add : function(x, y) {
					console.log(x + y);
					return x + y;
				},
				substract : function(x, y) {
					console.log(x - y);
					return x - y;
				}
			}
			Calculator.calc = function(command) {
				return Calculator[command.type](command.op1, command.op2);
			}
			Calculator.calc({
				type : 'add',
				op1 : 1,
				op2 : 1
			});
			Calculator.calc({
				type : 'substract',
				op1 : 3,
				op2 : 2
			});
		</script>
	</head>
	<body></body>
</html>